package gwtmodule1.client.gui.utils;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;

public class SwitchPage implements ClickListener , Command{
	private FrameProvider provider;

	private FrameClient client;

	private Object param;

	public SwitchPage(FrameProvider provider, FrameClient client) {
		super();
		this.provider = provider;
		this.client = client;
		this.param = null;
	}

	public SwitchPage(FrameProvider provider, FrameClient client, Object param) {
		super();
		this.provider = provider;
		this.client = client;
		this.param = param;
	}

	public void onClick(Widget sender) {
		execute();
	}

	public void execute() {
		client.onShow(param);
		provider.getFrame().setWidget((Widget) client);		
	}

}
